import uni from '@dcloudio/vite-plugin-uni'
// import legacy from '@vitejs/plugin-legacy'
import { defineConfig } from 'vite'
import mockPlugin from './scripts/vite-plugins/mock.js'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    uni(),
    mockPlugin,
    // legacy({
    //   targets: ['Chrome >= 50'], // 指定目标浏览器版本
    //   polyfills: ['es.promise', 'es.symbol'],
    // //   polyfills: true,
    // }),
  ],
  resolve: {
    alias: {

      '@': '/src',
    },
  },
  build: {
    rollupOptions: {
      input: {
        main: './index.html',
        web: './web.html',
      },
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        api: 'modern-compiler',
        silenceDeprecations: ['legacy-js-api'],
        quietDeps: true,
      },
    },
  },
})
